<?php

#################################################################
#								HTML
#################################################################

/**
 * Register form registed as 'layout/table/two_cols'
 * $vars['data'][] = array('title', 'input');
 * $vars['class']
 */

if($_CONTEXT=='HTML' && count($vars['data'])>0){
	$_CSS_STACK->push(blg_get_site_url().'layout/table/two_cols.css', TRUE);
	$_JS_STACK->push(blg_get_site_url().'layout/table/two_cols.js', TRUE);	
	
	$table_class= 'table_form_two_cols'.(!empty($vars['class'])?' '.$vars['class']:'');
	
	
	$content='<table class="'.$table_class.'">'."\n";	

	foreach($vars['data'] as $row){
		if(count($row)==1){
			$content.= '
			<tr>
				<td colspan="2" class="table_form_two_cols_center">'.$row[0].'</td>
			</tr>
			';			
		}else{
			list($title, $input)= $row;
			$content.= '
			<tr>
				<td class="table_form_two_cols_left '.(isset($title)?'table_form_two_cols_left_arrow':'').'">'.$title.'</td>
				<td class="table_form_two_cols_right">'.$input.'</td>
			</tr>
			';
		}			
	}
	
	$content.= '</table>'."\n";
	
	echo $content;
}
#################################################################
#								JS
#################################################################
elseif($_CONTEXT=='JS'){ ?>

<?php }
#################################################################
#								CSS
#################################################################
elseif($_CONTEXT=='CSS'){ ?>

table.table_form_two_cols{
	margin: 3px 5px;
}

table.table_form_two_cols td.table_form_two_cols_left,
table.table_form_two_cols td.table_form_two_cols_right,
table.table_form_two_cols td.table_form_two_cols_center{
	vertical-align: middle;	
	padding: 3px 0;
	font-size: 14px;
}

table.table_form_two_cols td.table_form_two_cols_left{
	text-align: right;
	padding-right: 14px;
	font-size: 12px;
	font-weight: bold;
	background-position: right center;
	background-repeat: no-repeat;
}

table.table_form_two_cols td.table_form_two_cols_left_arrow{
	background-image: url('<?php echo blg_get_site_url()?>_graphics/<?php echo blg_get_config('site_view')?>/icons/arrow_right.gif');
}

table.table_form_two_cols td.table_form_two_cols_right{
	padding-left: 4px;
}

table.table_form_two_cols td.table_form_two_cols_center{
	text-align: center;
	padding: 8px 0 6px 0;
}

<?php }
		